package com.sportsforce.client.twitter;

import com.google.gwt.jsonp.client.JsonpRequestBuilder;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;



/** 
 * Communicates via REST Web Service with Tweeter API and get the list of tweets
 for the specified user.
 * 
 * @Architecture 
 */

public class TwitterRequest {

	public static void getJsonpRequest(String url) {

		JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
		jsonp.requestObject(url, new AsyncCallback<Feed>() {
			public void onFailure(Throwable throwable) {
				Window.alert("Error: " + throwable);
				// Log.severe("Error: " + throwable);
			}

			public void onSuccess(Feed feed) {

				TweetList.getTweets(feed);

			}
		});

	}
}
